<template>
  <div id="app">
    <div style="display: flex; align-items: center; height: 60px; text-align: left">
      <img alt="Vue logo" style="height: 50px" src="./assets/logo.png"> <h3>微前端简介</h3>
    </div>
    <div style="display: flex;width: 100%">
      <div style="flex: 1;border: 2px solid #ebebeb; background: #fff;" >
        <HelloWorld msg="Welcome to Your Vue.js App" />
        <WujieVue width="100%" style="height: 400px" name="reactChild1" :url="reactChild1Url" />
      </div> 
     
      <div style="width: 300px; margin: 0 0 0 -2px; border: 2px solid #ebebeb; background: #f8f8f8;">
        <button @click="getVueChild1Data">获取子应用数据</button>
        <WujieVue width="100%" height="100%" name="vue3Child1" :url="vue3Child1Url"  :props="{ globalData: 'globalData20240301', methods: globalData20240301Nethods }"/>
      </div>
    </div>

  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    HelloWorld
  },
  data() {
    return {
      vue3Child1Url: 'http://localhost:5173/',
      reactChild1Url: 'http://127.0.0.1:9000/'
    }
  },
  methods: {
    globalData20240301Nethods (){
      console.log('globalData20240301Nethods')
      console.log(this)
    },
    getVueChild1Data(){
      console.log('getVueChild1Data')
      console.log(window.document.querySelector("iframe[name=vue3Child1]"))
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 20px;
}
</style>
